<script>

    $(document).ready(function(){
        selectDiv();
        $('#tipo').change(function() {
            selectDiv();


        });


    });
    
    function selectDiv(){
        
        if($('#tipo option:selected').val()==9){
            $('#cual').show("slow");
            
        }else{
            $('#cual').hide("slow");
            $('#WaterPollOtroCual').attr('value','');
        }
        
    } 

</script>
<div  id="loadimg" style="display: none;">
    <?php echo $html->image('loading.gif', array('border' => "0", 'align' => 'center')); ?>
</div>

<?php echo $form->create('WatersPolls'); ?>
<?php echo $form->hidden("WaterPoll.poll_id"); ?>
<?php echo $form->input("WaterPoll.water_source_id", array('options' => $water_sources, 'label' => 'Fuente', 'id' => 'tipo')); ?>
<div  id="cual" style="display: none;">
    <?php echo $form->input("WaterPoll.otro_cual"); ?>
</div>
<?php echo $form->input("WaterPoll.caudal"); ?>
<?php
$ch="";$ch2="";$ch3="";$ch4="";
if ($this->data['WaterPoll']['uso_domestico'] == 1){
    $ch1='checked';
}
if ($this->data['WaterPoll']['uso_agricultura'] == 1){
    $ch2='checked';
}
if ($this->data['WaterPoll']['uso_ganaderia'] == 1){
    $ch3='checked';
}
if ($this->data['WaterPoll']['uso_piscicola'] == 1){
    $ch4='checked';
}
    
    ?>

<?php echo $form->input("WaterPoll.uso_domestico"); ?>
<?php echo $form->input("WaterPoll.uso_agricultura", array('checked'=>$ch2,'type' => 'checkbox', 'value' => 1)); ?>
<?php echo $form->input("WaterPoll.uso_ganaderia", array('checked'=>$ch3,'type' => 'checkbox', 'value' => 1)); ?>
<?php echo $form->input("WaterPoll.uso_piscicola", array('checked'=>$ch4,'type' => 'checkbox', 'value' => 1)); ?>
<?php echo $form->input("WaterPoll.disponibilidad", array('options' => array('Temporal' => 'Temporal', 'Permanente' => 'Permanente'))); ?>
<?php echo $form->input("WaterPoll.descripcion");?>
<?php echo $ajax->submit('Guardar', array('url' => array('controller' => 'WaterPolls', 'action' => 'edit', $this->data['WaterPoll']['id']), 'update' => 'waters', 'indicator' => 'loadimg', 'complete' => 'cargar()')); ?>
<?php echo $form->end(); ?>
